﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsOrderManagement
{
    //ID、名称、单价
    public class Product
    {
        public string ID { get; set; }//商品号
        public string NAME { get; set; }//商品名称
        public decimal Price { get; set; }//价格
        public Product(string id, string name, decimal price)
        {
            ID = id;
            NAME = name;
            Price = price;
        }
        public override string ToString()
        {
            return $"Product ID:{ID}, Product Name: {NAME},Product price:{Price:C}";
        }
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
                return false;
            Product other = (Product)obj;
            return ID == other.ID && NAME == other.NAME && Price == other.Price;
        }
        public override int GetHashCode()
        {
            return (ID, NAME, Price).GetHashCode();
        }



    }
}
